//
//  PPDataAnalysisHandler.h
//  PPBlueToothDemo
//
//  Created by 彭思远 on 2020/7/31.
//  Copyright © 2020 彭思远. All rights reserved.
//

#import <Foundation/Foundation.h>

@class PPDeviceModel;
@class PPBodyBaseModel;
@class PPBatteryModel;

NS_ASSUME_NONNULL_BEGIN

typedef void(^reciveData2BodyBaseModelHandler)(id model);

@interface PPDataAnalysisHandler : NSObject

+ (BOOL)isCorrectADVData:(NSData *)receiveData;


/// 根据设备返回的数据进行解析
/// @param receiveDate 设备在‘didUpdateValueForCharacteristic’方法中拿到的数据
/// @param device  PPDeviceModel对象
/// @param bodyBaseModel  PPBodyBaseModel对象
/// @param handler 数据类型包括PPBodyBaseModel、PPBodyHistoryBaseModel、PPBodyFatModel
///
+ (void)receiveDate:(NSData *)receiveData deviceModel:(PPDeviceModel *)device bodyBaseModel:(PPBodyBaseModel *)bodyBaseModel analysis2BodyBaseModelWithHandler:(reciveData2BodyBaseModelHandler)handler;

+ (void)isBMDJTimingStart:(NSData *)reciveData status:(void(^)(BOOL isSuccess))handler;

+ (void)BMDJTimeInterval:(NSData *)reciveData withHandler:(void(^)(BOOL isEnd, NSInteger timeInterval, BOOL isFailed))handler;

+ (void)isBMDJTimingExit:(NSData *)reciveData status:(void(^)(BOOL isSuccess))handler;

+ (void)isConnect2Wifi:(NSData *)reciveData status:(void(^)(BOOL isSuccess, NSString *sn))handler;

+ (NSString *)serialNumberStringWithData:(NSData *)reciveData;

+ (NSArray *)torreHistoryWithData:(NSData *)data;

+ (PPBatteryModel *)analysisBatteryModelData:(NSData *)receiveData;
@end

NS_ASSUME_NONNULL_END
